<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'appr_history.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	 <link href="static/css/bootstrap.min.css" rel="stylesheet">
    <link href="static/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="static/css/style.min.css?v=4.1.0" rel="stylesheet">
    <link href="static/css/page.css" rel="stylesheet" type="text/css" />
    
	<script type="text/javascript" src="static/js/jquery-2.2.2.js"></script>
	<script type="text/javascript" src="static/js/page.js"></script>
	<script type="text/javascript" src="static/js/bootstrap.min.js"></script>
	<script type="text/javascript" src="static/layer/layer.js"></script>
	<style type="text/css">
		*{
    		margin: 0;
    		padding: 0;
  		}
  		
  		td{
  			display:inline-block;/*内联对象需加*/
  			word-break:keep-all;/* 不换行 */
			white-space:nowrap;/* 不换行 */
			overflow:hidden;/* 内容超出宽度时隐藏超出部分的内容 */
			text-overflow:ellipsis;/* 当对象内文本溢出时显示省略标记(...)*/
  		}
	</style>
	<script type="text/javascript">
	
	//扩展jQuery发送非ajax的post请求：使用jQuery 在内存中建立一个form对象，然后调用这个对象的submit方法
	$.extend({
	    StandardPost:function(url,args){
	        var form = $("<form method='post'></form>"),input;
	        form.attr({"action":url});
	        $.each(args,function(key,value){
	            input = $("<input type='hidden'>");
	            input.attr({"name":key});
	            input.val(value);
	            form.append(input);
	        });
	        form.submit();
	    }
	});
		
	
		function openApprInfo(title,introduce,URL,source,approveRemark,creationTime,approveTime){
			layer.open({
				  type: 1,
				  shift:-1,
				  area: ['800px', '500px'],
				  shadeClose: true, //点击遮罩关闭
				  content: '<div class="form-horizontal">'+
				  		'<div class="form-group"><h3 for="inputEmail3" class="col-sm-2 control-label">标题 :</h3>'+
					    '<div class="col-sm-10">'+'<h3 class="text-left">'+title+'</h3></div></div>'+
					    
					    '<div class="form-group"><h3 for="inputEmail3" class="col-sm-2 control-label">摘要 :</h3>'+
					    '<div class="col-sm-10">'+'<h3 class="text-left">'+introduce+'</h3></div></div>'+
					    
					    '<div class="form-group"><h3 for="inputEmail3" class="col-sm-2 control-label">URL :</h3>'+
					    '<div class="col-sm-10">'+'<h3 class="text-left">'+URL+'</h3></div></div>'+
					    
					    '<div class="form-group"><h3 for="inputEmail3" class="col-sm-2 control-label">来源 :</h3>'+
					    '<div class="col-sm-10">'+'<h3 class="text-left">'+source+'</h3></div></div>'+
					    
					    '<div class="form-group"><h3 for="inputEmail3" class="col-sm-2 control-label">备注 :</h3>'+
					    '<div class="col-sm-10">'+'<h3 class="text-left">'+approveRemark+'</h3></div></div>'+
					    
					    '<div class="form-group"><h3 for="inputEmail3" class="col-sm-2 control-label">提交时间 :</h3>'+
					    '<div class="col-sm-10">'+'<h3 class="text-left">'+creationTime+'</h3></div></div>'+
					    
					    '<div class="form-group"><h3 for="inputEmail3" class="col-sm-2 control-label">审核时间 :</h3>'+
					    '<div class="col-sm-10">'+'<h3 class="text-left">'+approveTime+'</h3></div></div>'+
					    '</div>',
					   
					    btn:['关闭']
				  });
		}
		
		function historyDelete(id){
			layer.open({
				  type: 1,
				  shift:-1,
				  area: ['250px', '200px'],
				  shadeClose: true, //点击遮罩关闭
				  content: '\<\h2 style="padding:20px;text-align: center;color:red">确认删除？\<\/h2>',
				  btn:['确定','取消'],
				  yes:function(index){
					    layer.close(index);
					    layer.load(1);
					    //此处演示关闭
					    setTimeout(function(){
					    layer.closeAll('loading');
					    }, 2000);
					    $.StandardPost('newsint/apprHistoryDelete',{'id':id,'page':'${newsInts.pageNo}'});
				  }
			});
		}
		
		function likeSearch(inputName){
    		$('#search_param').attr("name",inputName);
    	}
				
	</script>
  </head>
  
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content">
                    <div class="search-form">
                        <form action="newsint/getLikeApprHistory" method="post">
                            <div class="input-group">
                                <input type="text" id="search_param" placeholder="输入关键词" name="title" value="${likeParam}" class="form-control input-lg"/>
                                <div class="input-group-btn">
                                    <button class="btn btn-lg btn-primary" onclick="likeSearch('title')" type="submit">搜索标题</button>
                                </div>&nbsp;
                                <div class="input-group-btn">
                                    <button class="btn btn-lg btn-primary" onclick="likeSearch('introduce')" type="submit">搜索摘要</button>
                                </div>&nbsp;
                                <div class="input-group-btn">
                                    <button class="btn btn-lg btn-primary" onclick="likeSearch('URL')" type="submit">搜索URL</button>
                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="hr-line-dashed"></div>
                    
<table class="table table-striped table-bordered table-hover" style="table-layout:fixed">
	<thead>
		<tr>
			<th >标题</th>
			<th >摘要</th>
			<th >URL</th>
			<th >备注</th>
			<th >操作</th>
		</tr>
	</thead>
		<tbody>
		<c:forEach items="${newsInts.datas}" var="newsInt" varStatus="statu">
		<tr>
			<td title="${newsInt.title}" >${newsInt.title}</td>
			<td title="${newsInt.introduce}" >${newsInt.introduce}</td>
			<td title="${newsInt.URL}" >${newsInt.URL}</td>
			<td title="${newsInt.approveRemark}" >${newsInt.approveRemark}</td>
			<td style="text-align: center;">
				<button type="button" onclick="openApprInfo('${newsInt.title}','${newsInt.introduce}','${newsInt.URL}','${newsInt.source}','${newsInt.approveRemark}','${newsInt.creationTime}','${newsInt.approveTime}')" class="btn btn-primary">详情</button>
				<button type="button" onclick="historyDelete('${newsInt.id}')" class="btn btn-danger">删除</button>
			</td>
		</tr>
		</c:forEach>
		</tbody>
	</table>
                    
                   
                    <div class="text-center">
                    
                    	<div class="message">共<i class="blue">${newsInts.total}</i>条记录，每页显示&nbsp;<i class="blue"><label>${newsInts.onePageNum}</label>&nbsp;</i>条</div>
						<!--pagelistcount 设置一页显示多少条数据  -->
						<ul class="page" style="margin-left: 0px; margin-top:8px; padding-left: 0px;" maxshowpageitem="5" pagelistcount="${newsInts.onePageNum}" id="page"></ul>
						<br>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
	var isfirst = true;
	var GG = {
		"kk" : function(mm) {
			if(!isfirst){
				var likeParam = '${likeParam}';
				var url = "newsint/apprHistory?size=${newsInts.onePageNum}&page="+mm;
				if(likeParam!=''){
					//GET请求会中文乱码
					$.StandardPost('newsint/getLikeApprHistory',{'page':mm,'${likeParamName}':'${likeParam}'});
				}else{
					window.location.href = url;
				}
			}else{
				isfirst = false;
			}
		}
	};
	$("#page").initPage(${newsInts.total}, ${newsInts.pageNo}, GG.kk);
</script>
</body>
</html>
